<template>
	<view class="container">
		<view class="panel-header padding-top solid-bottom">
			<view class="g-goBack" @click="$common.toBack()">
				<view class="cuIcon-back"></view>
			</view>
			<view class="text-cut">个人中心</view>
		</view>
		<view class="menu">
			<view class="item" @click="toMyInfo()">
				<text>{{userInfo.nickname}}(<text class="cuIcon-phone"></text>******{{userInfo.phone|doLast4}})</text><text class="cuIcon-right"></text>
			</view>
		</view>
		<view class="menu">
			<!-- <view class="item">
				<text>客服中心</text><text class="cuIcon-right"></text>
			</view> -->
			<!-- <view class="item" @click="$utils.toURL('/tool/repairs/upload')">
				<text>意见反馈</text><text class="cuIcon-right"></text>
			</view> -->
			<!-- <view class="item" @click="$utils.toURL('/other/shopkeeper/agreement')">
				<text>商家协议</text><text class="cuIcon-right"></text>
			</view> -->
			<view class="item" @click="toWalletIndex()">
				<text>我的钱包</text><text class="cuIcon-right"></text>
			</view>
			<view class="item" @click="$utils.toURL('/login/resetPass')">
				<text>修改密码</text><text class="cuIcon-right"></text>
			</view>
		</view>
		<view class="foot"><text class="ftxt">{{version}}</text></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{},
				version:'V1.0.0'
			}
		},
		onLoad() {
			this.userInfo = this.$store.getters.GET_userInfo;
			if(!this.userInfo.token){
				uni.reLaunch({
					url:"/pages/login/login"
				})
			}
			this.version = this.$store.state.version;
		},
		methods: {	
			btnWorking(){
				uni.showToast({
					title:"开发中...",
					icon:"none"
				})
			},
			toWalletIndex(){
				uni.navigateTo({
					url:'./wallet/index'
				})
			},
			toMyInfo(){
				this.$utils.toURL('/mine/myInfo')
			}
		},
		filters:{
			doLast4(value){
				return value.slice(-4);
			},
		}
	}
</script>

<style lang="less">
	.menu{
		width: 90%;
		margin: 20rpx auto 0;
		background-color: white;
		border-radius: 20rpx;
		box-shadow: 0 0 20rpx #e0e0e0;
		padding: 20rpx;
		.item{
			height: 100rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			&:nth-child(n+2){
				border-top: 1rpx solid #f0f0f0;
			}
			.cuIcon-right{
				color: #999999;
			}
		}
	}
</style>
